package wzc.design_pattern.behaviour.iterator;

import java.util.List;

/**
 * @Author 那和不是个啥
 * @Date 2025/7/20
 * @Description
 */

public class BookShelfIterator implements Iterator<Book> {

    private final List<Book> books;
    private int index = 0;

    public BookShelfIterator(List<Book> books) {
        this.books = books;
    }

    @Override
    public boolean hasNext() {
        return index < books.size();
    }

    @Override
    public Book next() {
        return books.get(index++);
    }
}
